package nxu.it.validator;


import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

public class PostFormValidator extends Validator
{
    private static final String ERRORKEY="message";
    @Override
    protected void validate(Controller controller) {
        setShortCircuit(true);
validateRequiredString("title",ERRORKEY,"文章标题为空");
validateRequiredString("content",ERRORKEY,"文章内容为空");
validateRequired("category_id",ERRORKEY,"文章分类为空");
    }

    @Override
    protected void handleError(Controller controller) {
        controller.renderFreeMarker("error.ftl");
    }
}
